<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Praca magisterska: Plik źródłowy C:/Users/boski/Documents/Visual Studio 2008/Projects/cuda/blms/define.h</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  <td id="projectlogo"><img alt="Logo" src="logo_eti_small.png"/></td>
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Praca magisterska
   
   </div>
   <div id="projectbrief">Implementacja algorytmów filtracji adaptacyjnej o strukturze transwersalnej na platformie CUDA</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Wygenerowano przez Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Szukaj');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Strona&#160;główna</span></a></li>
      <li><a href="annotated.html"><span>Klasy</span></a></li>
      <li class="current"><a href="files.html"><span>Pliki</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Szukaj" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>Lista&#160;plików</span></a></li>
      <li><a href="globals.html"><span>Składowe&#160;plików</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('define_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">C:/Users/boski/Documents/Visual Studio 2008/Projects/cuda/blms/define.h</div>  </div>
</div>
<div class="contents">
<a href="define_8h.html">Idź do dokumentacji tego pliku.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00009"></a>00009 <span class="preprocessor">#ifndef DEFINE_H</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span><span class="preprocessor">#define DEFINE_H</span>
<a name="l00011"></a>00011 <span class="preprocessor"></span>
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &quot;cufft.h&quot;</span>
<a name="l00014"></a>00014 
<a name="l00015"></a><a class="code" href="define_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">00015</a> <span class="preprocessor">#define pi 3.141592653 ///&lt; liczba pi</span>
<a name="l00016"></a>00016 <span class="preprocessor"></span>
<a name="l00027"></a>00027 <span class="keyword">static</span> <span class="keywordtype">void</span> HandleError(cudaError_t err, <span class="keyword">const</span> <span class="keywordtype">char</span> *file, <span class="keywordtype">int</span> line) {
<a name="l00028"></a>00028     <span class="keywordflow">if</span> (err != cudaSuccess) {
<a name="l00029"></a>00029         printf(<span class="stringliteral">&quot;%s in %s at line %d\n&quot;</span>, cudaGetErrorString(err), file, line);
<a name="l00030"></a>00030         exit(EXIT_FAILURE);
<a name="l00031"></a>00031     }
<a name="l00032"></a>00032 }
<a name="l00033"></a>00033 
<a name="l00042"></a>00042 <span class="keyword">static</span> <span class="keywordtype">void</span> HandleCufftError(cufftResult_t err, <span class="keyword">const</span> <span class="keywordtype">char</span> *file, <span class="keywordtype">int</span> line) {
<a name="l00043"></a>00043     <span class="keywordflow">if</span> (err != CUFFT_SUCCESS) {
<a name="l00044"></a>00044         printf(<span class="stringliteral">&quot;CUFFT error nr %d in %s at line %d\n&quot;</span>, err, file, line);
<a name="l00045"></a>00045         exit(EXIT_FAILURE);
<a name="l00046"></a>00046     }
<a name="l00047"></a>00047 }
<a name="l00048"></a>00048 
<a name="l00049"></a><a class="code" href="define_8h.html#af415eaa6c6ad014020a7ece805612466">00049</a> <span class="preprocessor">#define HANDLE_ERROR(err) (HandleError(err, __FILE__, __LINE__)) ///&lt; makro HANDLE_ERROR &quot;CUDA By Example An Introduction to General-Purpose GPU Programming&quot; by Jason Sanders and Edward Kandrot, Addison-Wesley, Upper Saddle River, NJ, 2011</span>
<a name="l00050"></a><a class="code" href="define_8h.html#a2bdd6dfbf3612c6ff4266733ba13b7de">00050</a> <span class="preprocessor"></span><span class="preprocessor">#define HANDLE_CUFFT_ERROR(err) (HandleCufftError(err, __FILE__, __LINE__)) ///&lt; makro HANDLE_CUFFT_ERROR</span>
<a name="l00051"></a>00051 <span class="preprocessor"></span>
<a name="l00052"></a>00052 
<a name="l00053"></a>00053 <span class="comment">// fragment kodu z shrUtils.h określający liczbę rdzeni na karcie CUDA</span>
<a name="l00054"></a>00054 <span class="comment">// Beginning of GPU Architecture definitions</span>
<a name="l00055"></a>00055 <span class="keyword">inline</span> <span class="keywordtype">int</span> ConvertSMVer2Cores(<span class="keywordtype">int</span> major, <span class="keywordtype">int</span> minor)
<a name="l00056"></a>00056 {
<a name="l00057"></a>00057         <span class="comment">// Defines for GPU Architecture types (using the SM version to determine the # of cores per SM</span>
<a name="l00058"></a>00058         <span class="keyword">typedef</span> <span class="keyword">struct </span>{
<a name="l00059"></a>00059                 <span class="keywordtype">int</span> SM; <span class="comment">// 0xMm (hexidecimal notation), M = SM Major version, and m = SM minor version</span>
<a name="l00060"></a>00060                 <span class="keywordtype">int</span> Cores;
<a name="l00061"></a>00061         } sSMtoCores;
<a name="l00062"></a>00062 
<a name="l00063"></a>00063         sSMtoCores nGpuArchCoresPerSM[] = 
<a name="l00064"></a>00064         { { 0x10,  8 },
<a name="l00065"></a>00065           { 0x11,  8 },
<a name="l00066"></a>00066           { 0x12,  8 },
<a name="l00067"></a>00067           { 0x13,  8 },
<a name="l00068"></a>00068           { 0x20, 32 },
<a name="l00069"></a>00069           { 0x21, 48 },
<a name="l00070"></a>00070           {   -1, -1 }
<a name="l00071"></a>00071         };
<a name="l00072"></a>00072 
<a name="l00073"></a>00073         <span class="keywordtype">int</span> index = 0;
<a name="l00074"></a>00074         <span class="keywordflow">while</span> (nGpuArchCoresPerSM[index].SM != -1) {
<a name="l00075"></a>00075                 <span class="keywordflow">if</span> (nGpuArchCoresPerSM[index].SM == ((major &lt;&lt; 4) + minor) ) {
<a name="l00076"></a>00076                         <span class="keywordflow">return</span> nGpuArchCoresPerSM[index].Cores;
<a name="l00077"></a>00077                 }
<a name="l00078"></a>00078                 index++;
<a name="l00079"></a>00079         }
<a name="l00080"></a>00080         printf(<span class="stringliteral">&quot;MapSMtoCores undefined SMversion %d.%d!\n&quot;</span>, major, minor);
<a name="l00081"></a>00081         <span class="keywordflow">return</span> -1;
<a name="l00082"></a>00082 }
<a name="l00083"></a>00083 <span class="comment">// end of GPU Architecture definitions</span>
<a name="l00084"></a>00084 
<a name="l00085"></a>00085 
<a name="l00086"></a>00086 <span class="preprocessor">#endif </span><span class="comment">/* DEFINE_H */</span>
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="define_8h.html">define.h</a>      </li>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Klasy</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Pliki</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Funkcje</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Zmienne</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Definicje</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>


    <li class="footer">Wygenerowano Wed Nov 23 2011 12:30:13 dla Praca magisterska programem
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
